/*var string1,string2,string3;
var buf1,buf2,buf3;
var i;
console.time("write 1000 string");
for(i=0;i<1000;i++){
	var x=i+"";
	string1+=x;
}
console.timeEnd("write 1000 string");

console.time("write 1000 buffer");
buf1=new Buffer(1000);
for(i=0;i<1000;i++){
	var x=i+"";
	buf1.write(x,i);
}
console.timeEnd("write 1000 buffer");

console.time("write 100000 string");
for(i=0;i<100000;i++){
	var x=i+"";
	string2+=x;
}
console.timeEnd("write 100000 string");

console.time("write 100000 buffer");
buf2=new Buffer(100000);
for(i=0;i<100000;i++){
	var x=i+"";
	buf2.write(x,i);
}
console.timeEnd("write 100000 buffer");

console.time("write 1024*1024*10 string");
for(i=0;i<1024*1024*10;i++){
	var x=i+"";
	string3+=x;
}
console.timeEnd("write 1024*1024*10 string");

console.time("write 1024*1024*10 buffer");
buf3=new Buffer(1024*1024*10);
for(i=0;i<1024*1024*10;i++){
	var x=i+"";
	buf3.write(x,i);
}
console.timeEnd("write 1024*1024*10 buffer");


var os=require("os");
var leak_buf_ary=[];
var show_memory_usage=function(){
	console.log("free mem:"+Math.ceil(os.freemem()/(1024*1024))+"MB");
}
var do_buf_leak=function(){
	var leak_char="l";
	var loop=100000;
	var buf1_ary=[];
	while(loop--){
		buf1_ary.push(new Buffer(4096));
		leak_buf_ary.push(new Buffer(loop+leak_char));
	}
	console.log("before gc");
	show_memory_usage();
	buf1_ary=null;
	return;
}
console.log("process start");
show_memory_usage();
do_buf_leak();

var j=10000;
setInterval(function(){
	console.log("after gc");
	show_memory_usage();
});*/

/*var buf=new Buffer("dasdasdlkahslkfdahlksfjaljsfdlakjflskajlsfjlajkslfjalsfjlakjlkajlsfjkal");
console.time("string += buf");
var s="";
for(var i=0;i<10000;i++){
	s+=buf;
}
console.timeEnd("string += buf");

console.time("buf concat");
var list=[];
var len=0;
for(var i=0;i<10000;i++){
	list.push(buf);
	len+=buf.length;
}
var s2=Buffer.concat(list,len).toString();
console.timeEnd("buf concat");


var request=require("request");
var fs=require("fs");
request("http://www.baidu.com").pipe(fs.createWriteStream("f:\\aaa.html"));*/



var request=require("request");
var options={
	url:"http://www.maizuo.com/movie/cityMovies.htm?cityId=10",
	headers:{
		"User_Agent":"request"
	},
	data:{
		"cityId":10,
		"showFlag":1,
		"page":1,
		"resPerPage":4,
		"params":"mini"
	}
};
function callback(err,response,body){
	if(!err && response.statusCode==200){
		var info=JSON.parse(body);
		console.log(info);
	}
}
request(options,callback);